﻿using CIS.Common.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CIS.Common.Entitys
{
    public class JobEntity : BaseEntity
    {
        public JobEntity()
        {
            Id = Guid.NewGuid();
            CreationTime = DateTime.Now;
        }
        public string? LotId { get; set; }
        public string? ProductSize { get; set; }
        public string? JobId { get; set; }               
        public string? ProcessingFlag { get; set; }  
        public string? GlassType { get; set; }
        public string? DummyType { get; set; }        
        public int CassetteSequenceNo { get; set; }
        public int SlotSequenceNo { get; set; }
        public string? GlassCode { get; set; }  
        public string? PPID { get; set; }
        public string? ProductCategory { get; set; }
        public string? Judge { get; set; }
        public string? Grade { get; set; }
        public JobState Status { get; set; }
        public Single? TactTime { get; set; }
        public Single? CycleTime { get; set; }
        public DateTime? ProcessStartTime { get; set; }
        public DateTime? ProcessEndTime { get; set; }        
        public string? InPutPortId { get; set; }
        public string? OutPutPortId { get; set; }
        public string? OutPutCassetteId { get; set; }
        public string? Position { get; set; }
        public string? FromSlotNo { get; set; }
        public SlotPosition? SlotPositon { get; set; }
        public Productype? ProductType { get; set; }
        public string? ToSlotNo { get; set; }
        public int CurrentUnitPathNo { get; set; }
        public int CurrentSlotNo { get; set; }
        public SlotStatus SlotState { get; set; }
        public string? Thickness { get; set; }
        public string? WorkOrder { get; set; }
        public int CurrentDispatchStepNo { get; set; }
        public string? ProcessingInfo { get; set; } // N : Normal End, B : Abort End, L : Alarm End, F : Alarm Fail, S: Skip

        public string GetGlassThicknessCode(int thickness)
        {
            switch (thickness)
            {
                case 1:
                    return "0.1T";
                case 2:
                    return "0.2T";
                case 3:
                    return "0.3T";
                case 4:
                    return "0.4T";
                case 5:
                    return "0.5T";
                case 6:
                    return "0.6T";
                case 7:
                    return "0.7T";
                case 8:
                    return "0.8T";
                case 9:
                    return "0.9T";
                case 10:
                    return "1.0T";
                default:
                    return "0";
            }
        }
        public string GetGlassSizeCode(int size)
        {
            switch (size)
            {
                case 1:
                    return "1500*1850";
                //case "1500*950":
                case 2:
                    return "1500*925";
                case 3:
                    return "925*735";
                case 4:
                    return "920*730";
                default:
                    return "0";
            }
        }
    }
}
